Player Responses
When you want to give the player a choice of what to say, you use responses. Responses allow you to present several possible lines of dialogue, from which the player can select one.
Responses are marked with the ->
symbol. You can create as many responses as needed, and the player will choose one. Responses do not support line breaks or formatting tags.
Due to Telegram's limitations, a response cannot be longer than 127 characters.
For example, consider the following code:
What do you want to do next?
-> I want to go swimming.
-> I prefer hiking.
In this example, the line "What do you want to do next?" will appear, and the player will be given two options: "I want to go swimming" and "I prefer hiking". The player can select one.
Responses with Messages
Responses can trigger follow-up messages. When the player selects a response, the corresponding lines indented by 4 spaces will be executed.
In the following example, different lines will appear based on the chosen response:
What do you want to do next?
-> I want to go swimming.
Great, let’s go to the pool.
-> I prefer hiking.
Cool, let’s go for a hike.
Sounds good!
Here, the player chooses between "I want to go swimming" and "I prefer hiking". If swimming is selected, the line "Great, let's go to the pool" will appear. If hiking is selected, "Cool, let's go for a hike" will be shown. Regardless of the choice, the final line "Sounds good!" will appear.
Nested Responses
You can also nest responses inside other responses, creating more complex dialogue trees.
What do you want to do next?
-> I want to go swimming.
Where do you want to swim?
-> At the lake!
Great choice!
-> At the pool!
Sounds fun, there’s a new slide!
-> I prefer hiking.
Cool, let’s go for a hike.
Sounds good!
In this example, the player first chooses an activity, and then specifies where they'd like to swim if swimming is selected. Different lines appear based on their choice.
While nested responses are powerful, they can make your script harder to read. It’s often easier to use the <<jump>>
command to move to a different node and keep your script organized.
Sometimes, the responses or the outcomes of selecting them may depend on what the player has done or said earlier. This requires using conditions and variables, which we will discuss further.